<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <input type="text" class="a">
    <br>
    <input type="text" class="b">
    <br>
    <input type="text" class="c">
    <br>
    <input type="button" value="注册" class="d">

    <script src="../js/tools.js"></script>
    <script src="../js/api.js"></script>

    <script>

        const oUser = document.querySelector('.a') ;
        const oPwd = document.querySelector('.b') ;
        const oTel = document.querySelector('.c') ;
        const oBtn = document.querySelector('.d') ;

        oBtn.onclick = function() {
            const username = oUser.value ;
            const userpwd = oPwd.value ;
            const usertel = oTel.value ;
            if(username && userpwd && usertel) {
                reg({
                    username , 
                    userpwd , 
                    usertel
                }).then(res => {
                    console.log(res);
                })
            }
        }

    </script>
    
</body>
</html>